﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Practices.Prism.MefExtensions;
using System.ComponentModel.Composition.Hosting;
using UI.Web.SL.Demo.Infrastructure.Behaviors;

namespace UI.Web.SL.Demo
{
    public class Bootstrapper : MefBootstrapper
    {
        protected override void ConfigureAggregateCatalog()
        {
            this.AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof(Bootstrapper).Assembly));
            this.AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof(UI.Web.SL.Demo.Infrastructure.Events.AddCustomerCompletedEvent).Assembly));
            this.AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof(UI.Web.SL.Demo.Modules.Customer.CustomerModule).Assembly));
            this.AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof(UI.Web.SL.Demo.Modules.Log.LogModule).Assembly));
        }

        protected override DependencyObject CreateShell()
        {
            return this.Container.GetExportedValue<MainPage>();
        }

        protected override void InitializeShell()
        {
            App.Current.RootVisual = (MainPage)this.Shell;
        }

        protected override Microsoft.Practices.Prism.Regions.IRegionBehaviorFactory ConfigureDefaultRegionBehaviors()
        {
            var factory = base.ConfigureDefaultRegionBehaviors();

            factory.AddIfMissing("AutoPopulateExportedViewsBehavior", typeof(AutoPopulateExportedViewsBehavior));

            return factory;
        }
    }
}
